#pragma once

#include <map>
#include <string>



#define CommandLineObj CCommandLine::GetInstace()

class CCommandLine
{
public:
    CCommandLine();
    ~CCommandLine();

	static CCommandLine& GetInstace()
	{
		static CCommandLine gInstance;
		return gInstance;
	}

    int Split(wchar_t chSplit);
	bool GetPath(std::wstring& strPath);
    bool Find(const std::wstring& strKey, std::wstring& strValue);
	
	struct wstr_less //: std::binary_function<std::wstring&, std::wstring&, bool>
	{
		struct nocase_compare //: public std::binary_function<wchar_t, wchar_t, bool>
		{
			bool operator()(const wchar_t& c1, const wchar_t& c2) const
			{
				return tolower(c1) < tolower(c2);
			}
		};
		bool operator()(const std::wstring& s1, const std::wstring& s2) const
		{
			return std::lexicographical_compare(s1.begin(), s1.end(),
				s2.begin(), s2.end(),
				nocase_compare());
		}
	};
private:

	bool __Split(const wchar_t* strCommand, const wchar_t chSplit);
private:
    wchar_t m_split;
    std::wstring m_path;
    std::map<std::wstring, std::wstring, wstr_less> m_cmd;
};